from sklearn.feature_selection import SelectKBest
from sklearn.feature_selection import chi2, mutual_info_classif
from SBFI import func_sbf
def chi2_test(X,y,S,df_rating):
    test = SelectKBest(score_func=chi2, k=2)
    test.fit(X, y)
    scores = []
    num_features = len(X.columns)
    for i in range(num_features):
        score = test.scores_[i]
        scores.append((score, i))
    b=sorted(scores, reverse=False)
    ranks=[]
    for i in range(num_features):
        ranks.append(b[i][1])
    print(ranks)
    func_sbf(S,ranks,df_rating)